<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Annotations</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Annotations' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">bytecode</a></li><li><a href="index.html#2">Chapter 2: The Trees</a></li><li><b>Annotations</b></li></ul></div>
<p class="purpose">To mark symbols up with metadata.</p>

<ul class="toc"><li><a href="2-ann.html#SP1">&#167;1. The possible annotations</a></li><li><a href="2-ann.html#SP3">&#167;3. Canonical annotations</a></li><li><a href="2-ann.html#SP6">&#167;6. API for making annotations</a></li><li><a href="2-ann.html#SP7">&#167;7. API for reading annotations</a></li><li><a href="2-ann.html#SP8">&#167;8. Internal representation</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. The possible annotations.</b>Each annotation marks a symbol with a choice of <a href="2-ann.html#SP1" class="internal">inter_annotation_form</a> and
an associated value. That value can be of three possible data types: boolean
(in effect, the annotation is either made or not), integer (the value is an
associated number), or textual (it's a text).
</p>

<p class="commentary">Each annotation has a keyword used in textual Inter code: these by convention
always begin with <span class="extract"><span class="extract-syntax">__</span></span>.
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">INTEGER_IATYPE</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">TEXTUAL_IATYPE</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_annotation_form</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">annotation_ID</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">iatype</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the </span><span class="extract"><span class="extract-syntax">*_IATYPE</span></span><span class="comment-syntax"> constants above</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">annotation_keyword</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">inter_annotation_form</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure inter_annotation_form is accessed in 3/iibf, 3/iitf and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>We need rapid conversion between the annotation ID numbers, which range from
0 upwards, to their corresponding //inter_annotation_form//s.
</p>

<p class="commentary">Note that <a href="2-ann.html#SP2" class="internal">SymbolAnnotation::declare</a> returns <span class="extract"><span class="extract-syntax">FALSE</span></span> if two contradictory
definitions are made for the same ID. This is impossible when creating the
canonical set (see below), but is used to detect errors when binary Inter is
read in which had used an inconsistent set of annotations.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MAX_IAFS</span><span class="plain-syntax"> </span><span class="constant-syntax">64</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_annotation_form</span><span class="plain-syntax"> *</span><span class="identifier-syntax">invalid_IAF</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">inter_annotation_form</span><span class="plain-syntax"> *</span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_IAFS</span><span class="plain-syntax">];</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">iafs_registered_initialised</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::declare</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::declare</span></span>:<br/><a href="2-ann.html#SP4">&#167;4</a><br/>Inter in Binary Files - <a href="3-iibf.html#SP10_1_2">&#167;10.1.2</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">ID</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">keyword</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">iatype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">iafs_registered_initialised</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="constant-syntax">MAX_IAFS</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">iafs_registered_initialised</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ID</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">MAX_IAFS</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"ID out of range"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">]) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">keyword</span><span class="plain-syntax">, </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">]-&gt;</span><span class="element-syntax">annotation_keyword</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">] = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_annotation_form</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">]-&gt;</span><span class="element-syntax">annotation_ID</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ID</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">]-&gt;</span><span class="element-syntax">annotation_keyword</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">keyword</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">]-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">iatype</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ID</span><span class="plain-syntax"> == </span><span class="constant-syntax">INVALID_IANN</span><span class="plain-syntax">) </span><span class="identifier-syntax">invalid_IAF</span><span class="plain-syntax"> = </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. Canonical annotations.</b>The set of annotations used by the Inform tool suite is as follows.
</p>

<pre class="definitions code-font"><span class="definition-keyword">enum</span> <span class="constant-syntax">INVALID_IANN</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">ASSIMILATED_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">FAKE_ACTION_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">OBJECT_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">PRIVATE_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">KEEPING_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">C_ARRAY_ADDRESS_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">I6_GLOBAL_OFFSET_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">OBJECT_KIND_COUNTER_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">APPEND_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">INNER_PROPERTY_NAME_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">TRANSLATION_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">REPLACING_IANN</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">NAMESPACE_IANN</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>The special annotation <span class="extract"><span class="extract-syntax">__invalid</span></span>, with ID <span class="extract"><span class="extract-syntax">INVALID_IANN</span></span>, is never given to
any symbol: it's used to mean "do not make an annotation".
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::declare_canonical_annotations</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::declare_canonical_annotations</span></span>:<br/>Inter Constructs - <a href="3-ic.html#SP15">&#167;15</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">INVALID_IANN</span><span class="plain-syntax">,  </span><span class="identifier-syntax">I</span><span class="string-syntax">"__invalid"</span><span class="plain-syntax">, </span><span class="constant-syntax">INTEGER_IATYPE</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">ASSIMILATED_IANN</span><span class="plain-syntax">,         </span><span class="identifier-syntax">I</span><span class="string-syntax">"__assimilated"</span><span class="plain-syntax">,         </span><span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">FAKE_ACTION_IANN</span><span class="plain-syntax">,         </span><span class="identifier-syntax">I</span><span class="string-syntax">"__fake_action"</span><span class="plain-syntax">,         </span><span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">OBJECT_IANN</span><span class="plain-syntax">,              </span><span class="identifier-syntax">I</span><span class="string-syntax">"__object"</span><span class="plain-syntax">,              </span><span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PRIVATE_IANN</span><span class="plain-syntax">,             </span><span class="identifier-syntax">I</span><span class="string-syntax">"__private"</span><span class="plain-syntax">,             </span><span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">KEEPING_IANN</span><span class="plain-syntax">,             </span><span class="identifier-syntax">I</span><span class="string-syntax">"__keeping"</span><span class="plain-syntax">,             </span><span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">APPEND_IANN</span><span class="plain-syntax">,              </span><span class="identifier-syntax">I</span><span class="string-syntax">"__append"</span><span class="plain-syntax">,              </span><span class="constant-syntax">TEXTUAL_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">INNER_PROPERTY_NAME_IANN</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"__inner_property_name"</span><span class="plain-syntax">, </span><span class="constant-syntax">TEXTUAL_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">TRANSLATION_IANN</span><span class="plain-syntax">,         </span><span class="identifier-syntax">I</span><span class="string-syntax">"__translation"</span><span class="plain-syntax">,         </span><span class="constant-syntax">TEXTUAL_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">REPLACING_IANN</span><span class="plain-syntax">,           </span><span class="identifier-syntax">I</span><span class="string-syntax">"__replacing"</span><span class="plain-syntax">,           </span><span class="constant-syntax">TEXTUAL_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">NAMESPACE_IANN</span><span class="plain-syntax">,           </span><span class="identifier-syntax">I</span><span class="string-syntax">"__my"</span><span class="plain-syntax">,                  </span><span class="constant-syntax">TEXTUAL_IATYPE</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">C_ARRAY_ADDRESS_IANN</span><span class="plain-syntax">,     </span><span class="identifier-syntax">I</span><span class="string-syntax">"__array_address"</span><span class="plain-syntax">,       </span><span class="constant-syntax">INTEGER_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">I6_GLOBAL_OFFSET_IANN</span><span class="plain-syntax">,    </span><span class="identifier-syntax">I</span><span class="string-syntax">"__global_offset"</span><span class="plain-syntax">,       </span><span class="constant-syntax">INTEGER_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP2" class="function-link"><span class="function-syntax">SymbolAnnotation::declare</span></a><span class="plain-syntax">(</span><span class="constant-syntax">OBJECT_KIND_COUNTER_IANN</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"__object_kind_counter"</span><span class="plain-syntax">, </span><span class="constant-syntax">INTEGER_IATYPE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>This is printed when <a href="../inter/index.html" class="internal">inter</a> is run with the <span class="extract"><span class="extract-syntax">-annotations</span></span> switch.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::show_annotations</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"  Code     Annotation              Type of value\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">ID</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">ID</span><span class="plain-syntax">&lt;</span><span class="constant-syntax">MAX_IAFS</span><span class="plain-syntax">; </span><span class="identifier-syntax">ID</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_annotation_form</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax"> = </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">IC</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">ID</span><span class="plain-syntax"> != </span><span class="constant-syntax">INVALID_IANN</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"  %4x     %S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">ID</span><span class="plain-syntax">, </span><span class="identifier-syntax">IC</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_keyword</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">j</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_keyword</span><span class="plain-syntax">); </span><span class="identifier-syntax">j</span><span class="plain-syntax">&lt;24; </span><span class="identifier-syntax">j</span><span class="plain-syntax">++) </span><span class="identifier-syntax">PUT</span><span class="plain-syntax">(</span><span class="character-syntax">' '</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">IC</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">BOOLEAN_IATYPE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"none (boolean)\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">INTEGER_IATYPE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"integer\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TEXTUAL_IATYPE:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"text\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"unknown type\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. API for making annotations.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::set_b</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">annot_ID</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">n</span><span class="plain-syntax"> != </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">n</span><span class="plain-syntax"> != </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"non-boolean annotation value"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax"> = </span><a href="2-ann.html#SP9" class="function-link"><span class="function-syntax">SymbolAnnotation::from_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">annot_ID</span><span class="plain-syntax">, </span><span class="identifier-syntax">n</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP6" class="function-link"><span class="function-syntax">SymbolAnnotation::set</span></a><span class="plain-syntax">(</span><span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">IA</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::set_i</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">annot_ID</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax"> = </span><a href="2-ann.html#SP9" class="function-link"><span class="function-syntax">SymbolAnnotation::from_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">annot_ID</span><span class="plain-syntax">, </span><span class="identifier-syntax">n</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP6" class="function-link"><span class="function-syntax">SymbolAnnotation::set</span></a><span class="plain-syntax">(</span><span class="constant-syntax">INTEGER_IATYPE</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">IA</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::set_t</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::set_t</span></span>:<br/>Symbols - <a href="2-sym.html#SP20">&#167;20</a>, <a href="2-sym.html#SP21">&#167;21</a>, <a href="2-sym.html#SP22">&#167;22</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">annot_ID</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">text</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">n</span><span class="plain-syntax"> = </span><a href="2-tw.html#SP7" class="function-link"><span class="function-syntax">InterWarehouse::create_text</span></a><span class="plain-syntax">(</span><a href="2-it.html#SP3" class="function-link"><span class="function-syntax">InterTree::warehouse</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">), </span><span class="identifier-syntax">owner</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><a href="2-tw.html#SP7" class="function-link"><span class="function-syntax">InterWarehouse::get_text</span></a><span class="plain-syntax">(</span><a href="2-it.html#SP3" class="function-link"><span class="function-syntax">InterTree::warehouse</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">), </span><span class="identifier-syntax">n</span><span class="plain-syntax">), </span><span class="identifier-syntax">text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax"> = </span><a href="2-ann.html#SP9" class="function-link"><span class="function-syntax">SymbolAnnotation::from_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">annot_ID</span><span class="plain-syntax">, </span><span class="identifier-syntax">n</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP6" class="function-link"><span class="function-syntax">SymbolAnnotation::set</span></a><span class="plain-syntax">(</span><span class="constant-syntax">TEXTUAL_IATYPE</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">IA</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::set</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::set</span></span>:<br/><a href="2-ann.html#SP13">&#167;13</a><br/>Inter in Binary Files - <a href="3-iibf.html#SP10_1_3_2_2_1">&#167;10.1.3.2.2.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">iatype</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"annotated null symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">iatype</span><span class="plain-syntax"> == -1) </span><span class="identifier-syntax">iatype</span><span class="plain-syntax"> = </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-ann.html#SP11" class="function-link"><span class="function-syntax">SymbolAnnotation::write_to_set</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">iatype</span><span class="plain-syntax">, &amp;(</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotations</span><span class="plain-syntax">), </span><span class="identifier-syntax">IA</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. API for reading annotations.</b>An important convention here is that the default value for a boolean annotation
is <span class="extract"><span class="extract-syntax">FALSE</span></span>, whereas for an integer it is -1.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::get_b</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::get_b</span></span>:<br/>Transmigration - <a href="2-trn.html#SP3_5">&#167;3.5</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">const</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">ID</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><a href="2-ann.html#SP12" class="function-link"><span class="function-syntax">SymbolAnnotation::read_from_set</span></a><span class="plain-syntax">(</span><span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax">, &amp;(</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotations</span><span class="plain-syntax">), </span><span class="identifier-syntax">ID</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">found</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">found</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">val</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::get_i</span><span class="plain-syntax">(</span><span class="reserved-syntax">const</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">ID</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><a href="2-ann.html#SP12" class="function-link"><span class="function-syntax">SymbolAnnotation::read_from_set</span></a><span class="plain-syntax">(</span><span class="constant-syntax">INTEGER_IATYPE</span><span class="plain-syntax">, &amp;(</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotations</span><span class="plain-syntax">), </span><span class="identifier-syntax">ID</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">found</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">found</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">val</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">SymbolAnnotation::get_t</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::get_t</span></span>:<br/>Symbols - <a href="2-sym.html#SP20">&#167;20</a>, <a href="2-sym.html#SP21">&#167;21</a>, <a href="2-sym.html#SP22">&#167;22</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">ID</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><a href="2-ann.html#SP12" class="function-link"><span class="function-syntax">SymbolAnnotation::read_from_set</span></a><span class="plain-syntax">(</span><span class="constant-syntax">TEXTUAL_IATYPE</span><span class="plain-syntax">, &amp;(</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotations</span><span class="plain-syntax">), </span><span class="identifier-syntax">ID</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">found</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">found</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-tw.html#SP7" class="function-link"><span class="function-syntax">InterWarehouse::get_text</span></a><span class="plain-syntax">(</span><a href="2-it.html#SP3" class="function-link"><span class="function-syntax">InterTree::warehouse</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">), </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. Internal representation.</b>We can express an annotation either with an <a href="2-ann.html#SP8" class="internal">inter_annotation</a> structure or
with a pair of <span class="extract"><span class="extract-syntax">inter_ti</span></span> values:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_annotation_form</span><span class="plain-syntax"> *</span><span class="identifier-syntax">annot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">annot_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::value_annotation</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_annotation_form</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IAF</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">V</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax"> = </span><span class="identifier-syntax">IAF</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">V</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::invalid_annotation</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::invalid_annotation</span></span>:<br/><a href="2-ann.html#SP9">&#167;9</a>, <a href="2-ann.html#SP15">&#167;15</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax"> = </span><span class="identifier-syntax">invalid_IAF</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot_value</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::is_invalid</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::is_invalid</span></span>:<br/>Inter in Binary Files - <a href="3-iibf.html#SP10_1_3_2_2_1">&#167;10.1.3.2.2.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_ID</span><span class="plain-syntax"> == </span><span class="constant-syntax">INVALID_IANN</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure inter_annotation is accessed in 3/iibf, 3/iitf and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>Conversions:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::from_pair</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::from_pair</span></span>:<br/><a href="2-ann.html#SP6">&#167;6</a>, <a href="2-ann.html#SP14">&#167;14</a><br/>Inter in Binary Files - <a href="3-iibf.html#SP10_1_3_2_2_1">&#167;10.1.3.2.2.1</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">c1</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">c2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">iafs_registered_initialised</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c1</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">MAX_IAFS</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">c1</span><span class="plain-syntax">])) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax"> = </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">c1</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-ann.html#SP8" class="function-link"><span class="function-syntax">SymbolAnnotation::invalid_annotation</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::to_pair</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::to_pair</span></span>:<br/>Inter in Binary Files - <a href="3-iibf.html#SP10_2_3_2_2_1">&#167;10.2.3.2.2.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> *</span><span class="identifier-syntax">c1</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> *</span><span class="identifier-syntax">c2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">c1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_ID</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">c2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b>An "annotation set" is what it sounds like: a set (with no meaningful sequence)
containing annotations. Each annotation ID can occur at most once during the set.
A set is initially empty. Each <a href="2-sym.html#SP1" class="internal">inter_symbol</a> has an annotation set, but they
are also used when parsing textual Inter, which is why we don't assume that we
are working on a symbol here.
</p>

<p class="commentary">For efficiency's sake, we store boolean annotation values in a bitmap, and any
others in a linked list whose ordering has no meaning.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">boolean_annotations</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">other_annotations</span><span class="plain-syntax">; </span><span class="comment-syntax"> of </span><span class="extract"><span class="extract-syntax">inter_annotation</span></span>
<span class="plain-syntax">} </span><span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::new_annotation_set</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::new_annotation_set</span></span>:<br/>Symbols - <a href="2-sym.html#SP2">&#167;2</a><br/>Inter in Text Files - <a href="3-iitf.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax"> </span><span class="identifier-syntax">set</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">set</span><span class="plain-syntax">.</span><span class="element-syntax">boolean_annotations</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">set</span><span class="plain-syntax">.</span><span class="element-syntax">other_annotations</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">set</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::nonempty</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::nonempty</span></span>:<br/>Inter Constructs - <a href="3-ic.html#SP21">&#167;21</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">set</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">set</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        ((</span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">boolean_annotations</span><span class="plain-syntax"> != </span><span class="constant-syntax">0</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">LinkedLists::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax">))))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure inter_annotation_set is accessed in 3/iibf and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>To write an annotation to a set. Note that it is legal to write an annotation
which the set already has: in that case, the new value replaces the old one.
So writing <span class="extract"><span class="extract-syntax">__arrow_count=12</span></span> and then <span class="extract"><span class="extract-syntax">__arrow_count=7</span></span> results in a value of 7.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::write_to_set</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::write_to_set</span></span>:<br/><a href="2-ann.html#SP6">&#167;6</a><br/>Inter in Text Files - <a href="3-iitf.html#SP3_3">&#167;3.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">iatype</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">set</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_ID</span><span class="plain-syntax"> == </span><span class="constant-syntax">INVALID_IANN</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"added invalid annotation"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">iatype</span><span class="plain-syntax"> != </span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">STDERR</span><span class="plain-syntax">, </span><span class="string-syntax">"Annotation %S (%d) should have type %d but used %d\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_keyword</span><span class="plain-syntax">,  </span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_ID</span><span class="plain-syntax">, </span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax">, </span><span class="identifier-syntax">iatype</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"added annotation with wrong type"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">iatype</span><span class="plain-syntax"> == </span><span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot_value</span><span class="plain-syntax">) </span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">boolean_annotations</span><span class="plain-syntax"> |=   (1 &lt;&lt; </span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_ID</span><span class="plain-syntax">) ;</span>
<span class="plain-syntax">                      </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">boolean_annotations</span><span class="plain-syntax"> &amp;= (~(1 &lt;&lt; </span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_ID</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">NA</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">NA</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax">, </span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">NA</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annot</span><span class="plain-syntax"> == </span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">NA</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annot_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">NA</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">NA</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annot</span><span class="plain-syntax"> = </span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">NA</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annot_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">A</span><span class="plain-syntax">.</span><span class="element-syntax">annot_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">NA</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax">, </span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. </b>To read an annotation. <span class="extract"><span class="extract-syntax">found</span></span> is set to <span class="extract"><span class="extract-syntax">TRUE</span></span> if the annotation exists for
the set, and <span class="extract"><span class="extract-syntax">FALSE</span></span> otherwise. Note that every set contains all of the boolean
annotations, since they are stored in a bitmap which is always present.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::read_from_set</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::read_from_set</span></span>:<br/><a href="2-ann.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">iatype</span><span class="plain-syntax">, </span><span class="reserved-syntax">const</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">set</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">ID</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">found</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">iafs_registered_initialised</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">ID</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">MAX_IAFS</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">iatype</span><span class="plain-syntax"> != </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">]-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">STDERR</span><span class="plain-syntax">, </span><span class="string-syntax">"Annotation %S (%d) should have type %d but sought %d\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">]-&gt;</span><span class="element-syntax">annotation_keyword</span><span class="plain-syntax">, </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">]-&gt;</span><span class="element-syntax">annotation_ID</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">iafs_registered</span><span class="plain-syntax">[</span><span class="identifier-syntax">ID</span><span class="plain-syntax">]-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax">, </span><span class="identifier-syntax">iatype</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"sought IAF of wrong type"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">set</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">iatype</span><span class="plain-syntax"> == </span><span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">boolean_annotations</span><span class="plain-syntax"> &amp; (1 &lt;&lt; </span><span class="identifier-syntax">ID</span><span class="plain-syntax">)) { *</span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax">                                      { *</span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax">, </span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_ID</span><span class="plain-syntax"> == </span><span class="identifier-syntax">ID</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                        *</span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annot_value</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. </b>After parsing some annotations in textual Inter, and forming a set of those,
we then want to impose these on some new symbol:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::copy_set_to_symbol</span><button class="popup" onclick="togglePopup('usagePopup15')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup15">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::copy_set_to_symbol</span></span>:<br/>The Constant Construct - <a href="4-tcc2.html#SP6">&#167;6</a><br/>The Property Construct - <a href="4-tpc6.html#SP4">&#167;4</a><br/>The Variable Construct - <a href="4-tvc.html#SP4">&#167;4</a><br/>The Local Construct - <a href="5-tlc3.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">set</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">set</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotations</span><span class="plain-syntax">.</span><span class="element-syntax">boolean_annotations</span><span class="plain-syntax"> |= </span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">boolean_annotations</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax">, </span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><a href="2-ann.html#SP6" class="function-link"><span class="function-syntax">SymbolAnnotation::set</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, *</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. </b>Annotation sets can be written out as text. Note that booleans are only written
if true, because if false then they are indistinguishable from not being there at all.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::write_annotations</span><button class="popup" onclick="togglePopup('usagePopup16')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup16">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::write_annotations</span></span>:<br/>Inter Constructs - <a href="3-ic.html#SP19">&#167;19</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">) </span><a href="2-ann.html#SP14" class="function-link"><span class="function-syntax">SymbolAnnotation::write_set</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, &amp;(</span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotations</span><span class="plain-syntax">), </span><span class="identifier-syntax">F</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::write_set</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax"> *</span><span class="identifier-syntax">set</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">set</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">b</span><span class="plain-syntax">=1, </span><span class="identifier-syntax">c</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">c</span><span class="plain-syntax">&lt;30; </span><span class="identifier-syntax">b</span><span class="plain-syntax"> *= </span><span class="constant-syntax">2</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">boolean_annotations</span><span class="plain-syntax"> &amp; </span><span class="identifier-syntax">b</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><a href="2-ann.html#SP14" class="function-link"><span class="function-syntax">SymbolAnnotation::write_annotation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><a href="2-ann.html#SP9" class="function-link"><span class="function-syntax">SymbolAnnotation::from_pair</span></a><span class="plain-syntax">((</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">c</span><span class="plain-syntax">, </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax">, </span><span class="identifier-syntax">set</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">other_annotations</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><a href="2-ann.html#SP14" class="function-link"><span class="function-syntax">SymbolAnnotation::write_annotation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">F</span><span class="plain-syntax">, *</span><span class="identifier-syntax">A</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::write_annotation</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" %S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_keyword</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TEXTUAL_IATYPE:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"="</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::write_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><a href="2-in.html#SP14" class="function-link"><span class="function-syntax">Inode::ID_to_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot_value</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">INTEGER_IATYPE:</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"=%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot_value</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">BOOLEAN_IATYPE:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. </b>And annotations can also be parsed, with the same syntax:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="function-syntax">SymbolAnnotation::read_annotation</span><button class="popup" onclick="togglePopup('usagePopup17')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup17">Usage of <span class="code-font"><span class="function-syntax">SymbolAnnotation::read_annotation</span></span>:<br/>Inter in Text Files - <a href="3-iitf.html#SP3_3">&#167;3.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">text</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">iatype</span><span class="plain-syntax"> = </span><span class="constant-syntax">BOOLEAN_IATYPE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">) == </span><span class="character-syntax">'='</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::forward</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">)) == </span><span class="character-syntax">'"'</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">parsed_text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">EP</span><span class="plain-syntax"> = </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::parse_literal_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">parsed_text</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">.</span><span class="element-syntax">index</span><span class="plain-syntax">+2, </span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)-2, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">inter_warehouse</span><span class="plain-syntax"> *</span><span class="identifier-syntax">warehouse</span><span class="plain-syntax"> = </span><a href="2-it.html#SP3" class="function-link"><span class="function-syntax">InterTree::warehouse</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><a href="2-tw.html#SP7" class="function-link"><span class="function-syntax">InterWarehouse::create_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">warehouse</span><span class="plain-syntax">, </span><a href="2-it.html#SP3" class="function-link"><span class="function-syntax">InterTree::root_package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">));</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><a href="2-tw.html#SP7" class="function-link"><span class="function-syntax">InterWarehouse::get_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">warehouse</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">), </span><span class="identifier-syntax">parsed_text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">parsed_text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">EP</span><span class="plain-syntax">) *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EP</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">iatype</span><span class="plain-syntax"> = </span><span class="constant-syntax">TEXTUAL_IATYPE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = (</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">Str::atoi</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">.</span><span class="element-syntax">index</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">iatype</span><span class="plain-syntax"> = </span><span class="constant-syntax">INTEGER_IATYPE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Str::truncate</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">.</span><span class="element-syntax">index</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">inter_annotation_form</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IAF</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">IAF</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_annotation_form</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">IAF</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_keyword</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">IAF</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax"> != </span><span class="identifier-syntax">iatype</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"wrong sort of value for annotation"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">IAF</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">annotation_keyword</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax"> = </span><span class="identifier-syntax">IAF</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">val</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"unrecognised annotation"</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-ann.html#SP8" class="function-link"><span class="function-syntax">SymbolAnnotation::invalid_annotation</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="2-sym.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-bm.html">1</a></li><li class="progresscurrentchapter">2</li><li class="progresssection"><a href="2-it.html">it</a></li><li class="progresssection"><a href="2-in.html">in</a></li><li class="progresssection"><a href="2-bkm.html">bkm</a></li><li class="progresssection"><a href="2-np.html">np</a></li><li class="progresssection"><a href="2-tw.html">tw</a></li><li class="progresssection"><a href="2-pck.html">pck</a></li><li class="progresssection"><a href="2-inl.html">inl</a></li><li class="progresssection"><a href="2-st.html">st</a></li><li class="progresssection"><a href="2-sym.html">sym</a></li><li class="progresscurrent">ann</li><li class="progresssection"><a href="2-tw2.html">tw2</a></li><li class="progresssection"><a href="2-trn.html">trn</a></li><li class="progresschapter"><a href="3-ic.html">3</a></li><li class="progresschapter"><a href="4-tcc.html">4</a></li><li class="progresschapter"><a href="5-tac.html">5</a></li><li class="progresschapter"><a href="6-tpc.html">6</a></li><li class="progressnext"><a href="2-tw2.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

